<? Phpr_View::beginBlock("head") ?>
	<script type="text/javascript" src="modules/blog/resources/javascript/edit.js"></script>
	<script type="text/javascript" src="modules/backend/resources/javascript/unload_manager.js"></script>
	<script type="text/javascript">
		UnloadManager.unload_message = 'The post has been changed. Unsaved data will be lost.';
	</script>
<? Phpr_View::endBlock() ?>

<? Phpr_View::beginBlock("view") ?>
	<ul class="breadcrumbs">
		<li><a href="<?= url('/blog/posts') ?>">Posts</a></li>
		<li><?= $this->app_page_title ?></li>
	</ul>
	
	<?= flash() ?>

	<? if (!isset($fatalError)): ?>
		<div>
			<table class="layoutTable">
				<tr>
					<td>
						<?= Phpr_Form::openTag(array('id'=>'form_element')) ?>
							<? $this->formRender() ?>

							<?= backend_ajax_button('Create', 'create_onSave', array(), "prepareFunction: function(){phprTriggerSave();}, onBeforeScriptEval: function(){UnloadManager.reset_changes()}") ?>
							<?= backend_ajax_button('Create and Close', 'create_onSave', array(), "prepareFunction: function(){phprTriggerSave();}, extraFields: {create_close: 1}, onBeforeScriptEval: function(){UnloadManager.reset_changes()}") ?>
							<?= backend_ajax_button('Cancel', 'create_onCancel', array(), "onBeforeScriptEval: function(){UnloadManager.reset_changes()}") ?>
			
							<input type="hidden" value="1" id="new_record_flag"/>
							<div class="clear"></div>
						</form>
					</td>
					<td class="rightFixedColumn secondary_tabs">
						<? $this->renderPartial('sidebar') ?>
					</td>
				</tr>
			</table>
		</div>
	<? else: ?>
		<p><a href="<?= url('/blog/posts') ?>">Return to the post list</a></p>
	<? endif ?>
<? Phpr_View::endBlock() ?>